#ifndef CSE168_OPTIMUSMATERIUS_H_INCLUDED
#define CSE168_OPTIMUSMATERIUS_H_INCLUDED

#include "Material.h"

class OptimusMaterius : public Material
{
public:
    OptimusMaterius(const Vector3 & kd = Vector3(1,1,1), //Diffuse Rd component of the material (default = white)
			const Vector3 & ks = Vector3(0), //Specular Rs of the material, larger = more reflective (default = no reflection)
			const float shinyness = 0, //Shinyness coefficient, larger number = smaller specular highlight (default = no highlight)
			const Vector3 & kt = Vector3(0), //Refractive Rt of the material, larger = more transparent (default = no refraction)
			float (*rIndex)(short) = 0, //Refractive index of the material (default = no refraction)
			const Vector3 & ka = Vector3(0)); //Ambient light (default = no ambient light)
    virtual ~OptimusMaterius();

    const Vector3 & kd() const {return m_kd;}
	const Vector3 & ks() const {return m_ks;}
	const float & shinyness() const {return m_shinyness;}
	const Vector3 & kt() const {return m_kt;}
	//const float & rIndex() const {return refIndex(Green);}
    const Vector3 & ka() const {return m_ka;}

    void setKd(const Vector3 & kd) {m_kd = kd;}
	void setKs(const Vector3 & ks) {m_ks = ks;}
	void setShinyness(const float & shinyness) {m_shinyness = shinyness;}
	void setKt(const Vector3 & kt) {m_kt = kt;}
	//void setrIndex(const float & rIndex) {refIndex = rIndex;}
    void setKa(const Vector3 & ka) {m_ka = ka;}

    virtual void preCalc() {}
    
    virtual Vector3 shade(const Ray& ray, const HitInfo& hit, char rayCount, const Scene& scene,
                          int mode=RAYTRACE, Vector3 rayColor=Vector3(1), bool diffuseRay=false) const;

    virtual void handlePhoton(const Ray& ray, const HitInfo& hit, char rayCount, Vector3 photonFlux, const Scene& scene,
    					 	  int mode=APPM_PHOTON, LightPath *lp=0) const;
protected:
    Vector3 m_kd;
	Vector3 m_ks;
	float m_shinyness;
	Vector3 m_kt;
	float (*refIndex)(short); // this is a function pointer
    Vector3 m_ka;
};

#endif
